package controller;

import model.Perspective;

/**Commande pour faire une translation
 * @author Tony
 *
 */
public class TranslateCommand implements Command {

	private Perspective perspective;
	private int currentX;
	private int currentY;
	private int previousX;
	private int previousY;
	
	public TranslateCommand(Perspective perspective, int newX, int newY){
		this.perspective = perspective;
		this.currentX = newX;
		this.currentY = newY;
		this.previousX = perspective.getX();
		this.previousY = perspective.getY();
	}
	
	@Override
	public void execute() {
		perspective.setPosition(currentX, currentY);
	}

	@Override
	public void undo() {
		perspective.setPosition(previousX, previousY);
	}

}
